<template>
  <div class="img-item">
    <img :src="item.picUrl || item.cover" />
    <p>{{ item.name }}</p>
    <span v-if="item.playCount">{{ item.playCount | formatNumber }}</span>
  </div>
</template>
<script>
export default {
  props: {
    item: Object, 
  },
  filters: {
    formatNumber(value) {
      return (value / 10000).toFixed(1) + "万";
    },
  },
};
</script>
<style lang="less" scoped>
.img-item {
  position: relative;
  margin-bottom: 14px;
  img {
    display: block;
    width: 100%;
  }
  p {
    font-size: 14px;
    color: #555;
    padding: 6px 2px 0px 6px;
    text-overflow: -o-ellipsis-lastline;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  span {
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 12px;
    color: white;
    &::before {
      content: "";
      background-image: url();
      background-repeat: no-repeat;
      position: absolute;
      width: 12px;
      height: 12px;
      left: -14px;
      top: 0;
    }
  }
}
</style>